let t = require;
let  e = module
let  o =  e.exports;
 o.default =  e.exports;

                'use strict';
                console.log("start");
                var _n164,
                    i =
                    (this && this.__extends) ||
                    ((_n164 = function n(t, e) {
                            return (_n164 =
                                Object.setPrototypeOf ||
                                ({
                                        __proto__: []
                                    }
                                    instanceof Array &&
                                    function(t, e) {
                                        t.__proto__ = e;
                                    }) ||
                                function(t, e) {
                                    for (var o in e) {
                                        Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                                    }
                                })(t, e);
                        }),
                        function(t, e) {
                            function o() {
                                this.constructor = t;
                            }
                            _n164(t, e),
                                (t.prototype =
                                    null === e ?
                                    Object.create(e) :
                                    ((o.prototype = e.prototype), new o()));
                        }),
                    r =
                    (this && this.__decorate) ||
                    function(t, e, o, n) {
                        var i,
                            r = arguments.length,
                            a =
                            r < 3 ?
                            e :
                            null === n ?
                            (n = Object.getOwnPropertyDescriptor(e, o)) :
                            n;
                        if (
                            'object' ==
                            (typeof Reflect === 'undefined' ?
                                'undefined' :
                                typeof(Reflect)) &&
                            'function' == typeof Reflect.decorate
                        )
                            a = Reflect.decorate(t, e, o, n);
                        else
                            for (var s = t.length - 1; s >= 0; s--) {
                                (i = t[s]) &&
                                (a = (r < 3 ? i(a) : r > 3 ? i(e, o, a) : i(e, o)) || a);
                            }
                        return r > 3 && a && Object.defineProperty(e, o, a), a;
                    };
                Object.defineProperty(o, '__esModule', {
                        value: !0
                    }),
                    (o.StoreMrg = void 0);
                var a = t('AbsObject'),
                    s = t('TimeMrg'),
                    c = t('DateTimeUtils'),
                    l = t('StoreInfo'),
                    u = t('BattleUtils'),
                    h = t('ShopCfg'),
                    p = t('BagMrg'),
                    f = t('AbsInfo'),
                    d = t('ConstantCfg'),
                    g = t('CivilizationMrg'),
                    _ = cc._decorator,
                    y = _.ccclass,
                    C =
                    (_.property,
                        (function(t) {
                            function e() {
                                var e = t.call(this) || this;
                                return (
                                    g.CivilizationMrg.ins.on(
                                        f.InfoEvent.LevelChanged,
                                        e.onCivilizationLevelChangedHandler,
                                        e
                                    ),
                                    e
                                );
                            }
                            var o;
                            return (
                                i(e, t),
                                (o = e),
                                Object.defineProperty(e, 'ins', {
                                    get: function get() {
                                        return null == o._ins && (o._ins = new o()), this._ins;
                                    },
                                    enumerable: !1,
                                    configurable: !0
                                }),
                                (e.prototype.onCivilizationLevelChangedHandler = function() {
                                    this.update(g.CivilizationMrg.ins.id - 1);
                                }),
                                Object.defineProperty(e.prototype, 'refreshTime', {
                                    get: function get() {
                                        return this._refreshTime;
                                    },
                                    enumerable: !1,
                                    configurable: !0
                                }),
                                (e.prototype.init = function(t) {
                                    if (t) {
                                        if (t.rt)
                                            if (s.TimeMrg.serverTime < t.rt) {
                                                if (
                                                    ((this._refreshTime = t.rt),
                                                        (this._refreshCount = t.rc ?
                                                            t.rc :
                                                            d.ConstantCfg.ins.getValues(1)[0]),
                                                        (this._type1 = []),
                                                        (this._type2 = []),
                                                        (this._type3 = []),
                                                        t.t1)
                                                )
                                                    for (var e = 0; e < t.t1.length; e++) {
                                                        var o = t.t1[e];
                                                        (n = new l.StoreInfo()).setData(
                                                                h.ShopCfg.ins.getData(o.id)
                                                            ),
                                                            n.setExtra(o),
                                                            this._type1.push(n);
                                                    }
                                                if (t.t2)
                                                    for (e = 0; e < t.t2.length; e++) {
                                                        (o = t.t2[e]),
                                                        (n = new l.StoreInfo()).setData(
                                                                h.ShopCfg.ins.getData(o.id)
                                                            ),
                                                            n.setExtra(o),
                                                            this._type2.push(n);
                                                    }
                                                if (t.t3)
                                                    for (e = 0; e < t.t3.length; e++) {
                                                        var n;
                                                        (o = t.t3[e]),
                                                        (n = new l.StoreInfo()).setData(
                                                                h.ShopCfg.ins.getData(o.id)
                                                            ),
                                                            n.setExtra(o),
                                                            this._type3.push(n);
                                                    }
                                                this.checkRedDotState();
                                            } else this.initList(), this.updateRefreshTime();
                                    } else this.initList(), this.updateRefreshTime();
                                }),
                                (e.prototype.update = function(t) {
                                    for (var e = 0; e < this._type1.length; e++) {
                                        this._type1[e].update(t);
                                    }
                                    for (e = 0; e < this._type2.length; e++) {
                                        this._type2[e].update(t);
                                    }
                                    for (e = 0; e < this._type3.length; e++) {
                                        this._type3[e].update(t);
                                    }
                                }),
                                (e.prototype.setBind = function(t) {
                                    (this._bind = t),
                                    this._bind.setRedDotState(this._redDotState);
                                }),
                                (e.prototype.checkRedDotState = function() {
                                    for (var t = !1, e = 0; e < this._type1.length; e++) {
                                        if ((o = this._type1[e]).free > 0 && o.count > o.limitNum) {
                                            t = !0;
                                            break;
                                        }
                                    }
                                    if (!t)
                                        for (e = 0; e < this._type2.length; e++) {
                                            if (
                                                (o = this._type2[e]).free > 0 &&
                                                o.count > o.limitNum
                                            ) {
                                                t = !0;
                                                break;
                                            }
                                        }
                                    if (!t)
                                        for (e = 0; e < this._type3.length; e++) {
                                            var o;
                                            if (
                                                (o = this._type3[e]).free > 0 &&
                                                o.count > o.limitNum
                                            ) {
                                                t = !0;
                                                break;
                                            }
                                        }
                                    t != this._redDotState &&
                                        ((this._redDotState = t),
                                            this._bind && this._bind.setRedDotState(t));
                                }),
                                Object.defineProperty(e.prototype, 'refreshCount', {
                                    get: function get() {
                                        return this._refreshCount;
                                    },
                                    enumerable: !1,
                                    configurable: !0
                                }),
                                Object.defineProperty(e.prototype, 'type1', {
                                    get: function get() {
                                        return this._type1;
                                    },
                                    enumerable: !1,
                                    configurable: !0
                                }),
                                Object.defineProperty(e.prototype, 'type2', {
                                    get: function get() {
                                        return this._type2;
                                    },
                                    enumerable: !1,
                                    configurable: !0
                                }),
                                Object.defineProperty(e.prototype, 'type3', {
                                    get: function get() {
                                        return this._type3;
                                    },
                                    enumerable: !1,
                                    configurable: !0
                                }),
                                (e.prototype.buy = function(t) {
                                    t &&
                                        ((t.count > t.limitNum && t.free > 0) ||
                                            (1 != t.priceType && 2 != t.priceType) ||
                                            p.BagMrg.ins.useItem(t.priceType, t.price),
                                            t.count--,
                                            this.checkRedDotState());
                                }),
                                (e.prototype.buyByFree = function(t) {
                                    t &&
                                        ((1 != t.priceType && 2 != t.priceType) ||
                                            p.BagMrg.ins.useItem(t.priceType, t.price),
                                            t.count--,
                                            this.checkRedDotState());
                                }),
                                (e.prototype.buyBuyAd = function(t) {
                                    t &&
                                        t &&
                                        t.boxRefreshTime > 0 &&
                                        (t.resetTime(), this.checkRedDotState());
                                }),
                                (e.prototype.refreshDayStore = function() {
                                    if (this._refreshCount > 0) {
                                        for (
                                            var t = u.default.refreshDailyShopItems(), e = 1; e < t.length; e++
                                        ) {
                                            var o = t[e],
                                                n = new l.StoreInfo();
                                            n.setData(o), (this._type1[e] = n);
                                        }
                                        this._refreshCount--, this.emit(f.InfoEvent.Changed);
                                    }
                                }),
                                (e.prototype.updateRefreshTime = function() {
                                    this._refreshTime = c.DateTimeUtils.getZero(
                                        s.TimeMrg.serverTime + c.DateTimeUtils.Day2Millisecond + 1e3
                                    );
                                }),
                                (e.prototype.initList = function() {
                                    var t = u.default.refreshDailyShopItems();
                                    (this._type1 = []),
                                    (this._type2 = []),
                                    (this._type3 = []),
                                    (this._refreshCount = d.ConstantCfg.ins.getValues(1)[0]);
                                    for (var e = 0; e < t.length; e++) {
                                        var o = t[e];
                                        (n = new l.StoreInfo()).setData(o), this._type1.push(n);
                                    }
                                    for (
                                        t = h.ShopCfg.ins.getListByType(2), e = 0; e < t.length; e++
                                    ) {
                                        (o = t[e]),
                                        (n = new l.StoreInfo()).setData(o),
                                            this._type2.push(n);
                                    }
                                    for (
                                        t = h.ShopCfg.ins.getListByType(3), e = 0; e < t.length; e++
                                    ) {
                                        var n;
                                        (o = t[e]),
                                        (n = new l.StoreInfo()).setData(o),
                                            this._type3.push(n);
                                    }
                                    this.checkRedDotState();
                                }),
                                (e.prototype.getData = function() {
                                    var t = {};
                                    (t.rt = this._refreshTime),
                                    (t.rc = this._refreshCount),
                                    (t.t1 = []);
                                    for (var e = 0; e < this._type1.length; e++) {
                                        var o = this._type1[e];
                                        t.t1.push(o.getJson());
                                    }
                                    for (t.t2 = [], e = 0; e < this._type2.length; e++) {
                                        (o = this._type2[e]), t.t2.push(o.getJson());
                                    }
                                    for (t.t3 = [], e = 0; e < this._type3.length; e++) {
                                        (o = this._type3[e]), t.t3.push(o.getJson());
                                    }
                                    return t;
                                }),
                                (e.prototype.newDay = function() {
                                    this.updateRefreshTime(),
                                        this.initList(),
                                        this.emit(f.InfoEvent.Changed);
                                }),
                                (o = r([y('StoreMrg')], e))
                            );
                        })(a.AbsObject));
                (o.StoreMrg = C), console.log("end");
            module.exports =  e.exports;